
library(GWmodel)
data("meuse")
meuse<-meuse[,1:8]
meuse.xy<-meuse
coordinates(meuse.xy)<-~x+y


library(dplyr)
predata<-apply(meuse,2,mean)%>%as.data.frame%>%t%>%as.data.frame
coordinates(predata)<-c('x','y')

formula.gwr<-'cadmium~dist'%>%as.formula()
col.bw<-bw.gwr(formula.gwr,data = meuse.xy,longlat = F)
col.bw<-227.7897
fit<-gwr.basic(formula.gwr,data = meuse.xy,bw = col.bw)
# pre<-gwr.basic(formula.gwr,data = meuse.xy,bw = col.bw,
#                regression.points = predata)
# 
# pre$SDF$pred

gwr.pred<-gwr.predict(formula.gwr,data = meuse.xy,bw = col.bw,
               predictdata = predata)
gwr.pred$SDF$prediction




